/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.zb.hms.data.hms.user.entity;

import com.zb.hms.base.util.stringUtil.RegexConstants;
import com.zb.hms.base.util.validationUtil.constraint.Name;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;


/**
 * @Description 用户信息
 * @author zb
 * @datetime 2017-7-30 14:13
 * @version V1.0
 * @serial JDK 1.8
 */
@Entity
@Table(name = "static_user")
public class User implements Serializable{
    private static final long serialVersionUID = 7399097271793662774L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    private Integer id;
    @NotBlank
    @Length(min =6,max =12)
    @Pattern(regexp = RegexConstants.ISALPHANUMERIC,message = RegexConstants.ISALPHANUMERICMES)
    @Column(name = "user_account",nullable = false,length = 12,unique = true)
    private String account;
    @NotBlank
    @Length(min=6,max =18)
    @Pattern(regexp = RegexConstants.ISCHARANDNUMBER ,message =RegexConstants.ISCHARANDNUMBERMES)
    @Column(name="user_password",nullable = false,length =18)
    private String password; 
    @Column(name="user_head_image",nullable = false,unique = true)
    private String head_image;
    @Name
    @Column(name="user_name",length = 8)
    private String name ;
    @Past
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="user_in_time",nullable = false)
    private Date in_time;
    @NotBlank
    @Pattern(regexp =  RegexConstants.ISQQ,message = RegexConstants.ISQQMES)
    @Column(name ="user_QQ",nullable = false,length = 10,unique = true)
    private String qq;
    @NotBlank
    @Pattern(regexp = RegexConstants.ISPHONE ,message = RegexConstants.ISPHONEMES)
    @Column(name="user_phone",nullable = false,length =11)
    private String phone;
    @NotBlank
    @Email
   @Column(name = "user_email",nullable = false,length = 50,unique = true)
    private String email;
//    @NotNull
    @Column(name = "user_type_id",nullable = false,length = 3)
    private Integer type_id;
    @Override
    public String toString(){
        return "id:"+this.id+",\taccount:"+this.account+",\temail:"+this.email+",\thead_image:"+this.head_image+",\tname:"+this.name+",\tpassword:"+this.password+",\tqq:"+this.qq+",\tphone:"+this.phone;
    }
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * @return the account
     */
    public String getAccount() {
        return account;
    }

    /**
     * @param account the account to set
     */
    public void setAccount(String account) {
        this.account = account;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * @return the head_image
     */
    public String getHead_image() {
        return head_image;
    }

    /**
     * @param head_image the head_image to set
     */
    public void setHead_image(String head_image) {
        this.head_image = head_image;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the in_time
     */
    public Date getIn_time() {
        return in_time;
    }

    /**
     * @param in_time the in_time to set
     */
    public void setIn_time(Date in_time) {
        this.in_time = in_time;
    }

    /**
     * @return the QQ
     */
    public String getQq() {
        return qq;
    }

    /**
     * @param QQ the QQ to set
     */
    public void setQq(String qq) {
        this.qq = qq;
    }

    /**
     * @return the phone
     */
    public String getPhone() {
        return phone;
    }

    /**
     * @param phone the phone to set
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * @return the email
     */
    public String getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * @return the type
     */
    public Integer getType_id() {
        return type_id;
    }

    /**
     * @param type_id
     */
    public void setType_id(Integer type_id) {
        this.type_id = type_id;
    }
}
